Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] add C and C++ SSL quickstarts #10771

Closed

Conversation

polarweasel
Copy link
Contributor

Starting with C, and will add C++ once we get C working. 😁

@netlify /latest/quick-start/build-apps/c/ysql/#use-c-with-ssl

@polarweasel polarweasel requested a review from Sfurti-yb December 3, 2021 02:23
@netlify
Copy link

netlify bot commented Dec 3, 2021

✔️ Deploy Preview for infallible-bardeen-164bc9 ready!

🔨 Explore the source changes: c6f43a0

🔍 Inspect the deploy log: https://app.netlify.com/sites/infallible-bardeen-164bc9/deploys/61a97f9acdc1bd0007a180e6

😎 Browse the preview: https://deploy-preview-10771--infallible-bardeen-164bc9.netlify.app/latest/quick-start/build-apps/c/ysql/#use-c-with-ssl

@netlify
Copy link

netlify bot commented Dec 3, 2021

✔️ Deploy Preview for infallible-bardeen-164bc9 ready!

🔨 Explore the source changes: e5a31bd

🔍 Inspect the deploy log: https://app.netlify.com/sites/infallible-bardeen-164bc9/deploys/61aad0ca96266400071fbe06

😎 Browse the preview: https://deploy-preview-10771--infallible-bardeen-164bc9.netlify.app/latest/quick-start/build-apps/c/ysql/#use-c-with-ssl

1. You can compile the file using `gcc` or `clang`. To compile the application with `clang`, run the following command:

```sh
$ clang yb_hello_world_ssl.c \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ clang ybsql_hello_world_ssl.c

```sh
$ clang yb_hello_world_ssl.c \
-lpq \
-I path/to/yugabytedb/postgres/include -L path/to/yugabytedb/postgres/postgres/lib \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path/to/yugabytedb/postgres/lib

1. Run with:

```sh
$ ./ybsql_hello_world
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ ./ybsql_hello_world_ssl


The default SSL mode for libpq is `prefer`. In the `require` SSL mode, the root CA certificate is not required to be configured.

To enable `verify-ca` and `verify-full`, you configure the path to the CA in the connection string using the `sslrootcert` parameter. The default path is `~/.postgresql/root.crt`. If the root certificate is in a different file, specify it in the sslrootcert parameter. For example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got error "Connection to database failed: root certificate file "/Users/myuser/.yugabytedb/root.crt" does not exist" which implies .postgresql is not the default directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants